<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('AdminOrder/index')}">工单列表</a></li>
        <li><a href="{:url('AdminLaoren/gdlrlist')}">录单</a></li>
    </ul>
    <form class="well form-inline margin-top-20" method="post" action="{:url('AdminOrder/index')}" id="search">
        <input type="hidden" name="pagenum" value="{$pagenum|default='10'}" id="pagenum">
        残疾人姓名:
        <input type="text" class="form-control" name="keyword" style="width: 150px;"
               value="{$keyword|default=''}" placeholder="请输入关键字">
        证件号码:
        <input type="text" class="form-control" name="zjnum" style="width: 150px;" value="{$zjnum|default=''}"
            placeholder="请输入证件号码">
        录单日期:
        <input type="date" min="0001-01-02" max="9999-12-31" class="form-control" name="start_time" style="width: 150px;" value="{$start_time|default=''}"
            placeholder="请输入日期">-<input type="date" min="0001-01-02" max="9999-12-31" class="form-control" name="end_time" style="width: 150px;" value="{$end_time|default=''}"
                placeholder="请输入日期">
        完成时间:
        <input type="date" min="0001-01-02" max="9999-12-31" class="form-control" name="start_finish_time" style="width: 150px;" value="{$start_finish_time|default=''}"
               placeholder="请输入日期">-<input type="date" min="0001-01-02" max="9999-12-31" class="form-control" name="end_finish_time" style="width: 150px;" value="{$end_finish_time|default=''}"
                                           placeholder="请输入日期">
        状态:
        <select class="form-control" name="gdstatus">
            <option value=""  >全部</option>
            <option value="已录单"  <if condition="$gdstatus eq '已录单'">selected</if>>已录单</option>
            <option value="待接单" <if condition="$gdstatus eq '待接单'">selected</if>>待接单</option>
            <option value="待服务" <if condition="$gdstatus eq '待服务'">selected</if>>待服务</option>
            <option value="待审核" <if condition="$gdstatus eq '待审核'">selected</if>>待审核</option>
            <option value="已完成" <if condition="$gdstatus eq '已完成'">selected</if>>已完成</option>
            <option value="已退款" <if condition="$gdstatus eq '已退款'">selected</if>>已退款</option>
            <option value="已拒单" <if condition="$gdstatus eq '已拒单'">selected</if>>已拒单</option>
        </select>
        <button class="btn btn-primary">搜索</button>

        <a class="btn btn-primary js-ajax-dialog-url" href="{:url('AdminOrder/daochu',array('keyword'=>$keyword, 'zjnum' => $zjnum, 'start_time' => $start_time, 'end_time' => $end_time, 'start_finish_time'=>$start_finish_time, 'end_finish_time'=>$end_finish_time, 'gdstatus' => $gdstatus))}" data-msg="确定导出数据吗？">导出</a>
        
    </form>
    <form class="js-ajax-form" method="post">
        <button class="btn btn-danger btn-sm js-ajax-submit" type="submit" onclick="daochu1()"
            data-subcheck="true" data-msg="确定导出数据吗？">导出
        </button>
        <!-- <div class="table-actions">
            <button class="btn btn-danger btn-sm js-ajax-submit" type="submit" data-action="{:url('AdminPage/delete')}"
                    data-subcheck="true" data-msg="{:lang('DELETE_CONFIRM_MESSAGE')}">{:lang('DELETE')}
            </button>
        </div> -->
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="16">
                    <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </label>
                </th>
                <th width="80">序号</th>
                <th width="100">工单编号</th>
                <th width="100">残疾人姓名</th>
                <th width="80">性别</th>
                <th width="80">年龄</th>
                <th width="100">残疾等级</th>
                <th width="160">残疾人联系方式</th>
                <th width="160">身份证号</th>
                <th width="160">服务类型</th>
                <th width="160">服务机构</th>
                <th width="120">服务员姓名</th>
                <th width="200">服务员电话</th>
                <th width="160">录单人ID</th>
                <th width="200">录单时间</th>
                <th width="200">完成时间</th>
                <th width="80">状态</th>
                <if condition="$gdstatus eq '已完成'">
                    <th width="80">余额</th>
                </if>
                <th width="200">操作</th>
            </tr>
            </thead>
            <php>$status=array("1"=>'已发布',"0"=>'未发布');</php>
            <foreach name="pages" key="key" item="vo">
                <tr>
                    <td>
                        <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
                               value="{$vo.id}" data-id="{$vo.id}">
                            <input class="form-control" type="hidden" style="width:400px;" required value="{$vo.more.xm|default=''}" placeholder="请选择项目"
                                id="js-xm{$vo.id}"  readonly />
                    </td>
                    <td>{$xhpage + $key}</td>
                    <td>{$vo.post_source}</td>
                    <td>
                        {$vo.post_title}
                    </td>
                    <td>{$sexArray[$key]}</td>
                    <td>{$ageArray[$key]}</td>
                    <td>{$olderTypeArray[$key]}</td>
                    <td>{$vo.more.tel|default=''}</td>
                    <td>{$vo.more.zjnum|default=''}</td>
                    <td id="xm{$vo.id}">{$vo.post_keywords|default=''}</td>
                    <td>{$vo.more.mendian|default=''}</td>
                    <td>{$vo.more.mendianfwy|default=''}</td>
                    <td>{$vo.more.mendianfwytel|default=''}</td>
                    <td>{$vo.user_id}</td>
                    <td>
                        <empty name="vo.published_time">
                            未发布
                            <else/>
                            {:date('Y-m-d H:i',$vo['published_time'])}
                        </empty>
                    </td>
                    <td>
                        <empty name="vo.finish_time">
                            -
                            <else />
                            {:date('Y-m-d H:i',$vo['finish_time'])}
                        </empty>
                    </td>
                    <td>
                        {$vo.gdstatus}
                    </td>
                    <if condition="$gdstatus eq '已完成'">
                        <td>
                        {$moneyArray[$key]}
                        </td>
                    </if>
                    <td>
                        
                        <if condition="$vo.gdstatus == '已录单' ">
                        <a class="btn btn-xs btn-primary" href="{:url('AdminOrder/edit',array('id'=>$vo['id']))}">编辑</a>
                        <a class="btn btn-xs btn-primary" href="{:url('AdminOrder/paidan',array('id'=>$vo['id']))}">派单</a>
                        
                        <elseif condition="$vo.gdstatus == '待接单' or $vo.gdstatus == '已拒单' ">
                            <a class="btn btn-xs btn-primary" target="view_window" href="{:url('AdminOrder/paidan',array('id'=>$vo['id'],'ck'=>1))}">查看</a>
                            <a class="btn btn-xs btn-primary" href="{:url('AdminOrder/paidan',array('id'=>$vo['id']))}">重新派单</a>
                        
                        <elseif condition="$vo.gdstatus == '待审核' ">
                            <a class="btn btn-xs btn-primary" href="{:url('AdminOrder/shenhe',array('id'=>$vo['id']))}">审核</a>
                       
                        <elseif condition="$vo.gdstatus == '已退款' ">
                            <a class="btn btn-xs btn-primary" href="{:url('AdminOrder/paidan',array('id'=>$vo['id']))}">重新派单</a>
                        <else>
                            <a class="btn btn-xs btn-primary" target="view_window" href="{:url('AdminOrder/shenhe',array('id'=>$vo['id'],'ck'=>1))}">查看</a>
                        </if>
                        <if condition="$vo.gdstatus == '已完成'">
                            <a class="btn btn-xs btn-success" href="{:url('AdminOrder/add',array('id'=>$vo['id']))}">录单</a>
                        </if>
                        <!-- <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('AdminOrder/delete',array('id'=>$vo['id']))}">{:lang('DELETE')}</a> -->
                        <if condition="$vo.gdstatus != '已退款' and $vo.gdstatus != '已录单' ">
                            <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('AdminOrder/tuikuanPost',array('id'=>$vo['id']))}"
                                data-msg="确定退款吗？">退款</a>
                        </if>
                        
                    </td>
                </tr>
            </foreach>
            <tfoot>
            <!-- <tr>
                <th width="16">
                    <label>
                        <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
                    </label>
                </th>
                <th width="100">工单ID</th>
                <th width="100">残疾人姓名</th>
                <th width="160">残疾人联系方式</th>
                <th width="160">家政服务项目</th>
                <th width="160">门店</th>
                <th width="120">服务员姓名</th>
                <th width="200">服务员电话</th>
                <th width="160">录单人ID</th>
                <th width="200">录单时间</th>
                <th width="80">状态</th>
                <th width="200">操作</th>
            </tr>
            </tfoot> -->
        </table>
        <!-- <div class="table-actions">
            <button class="btn btn-danger btn-sm js-ajax-submit" type="submit" data-action="{:url('AdminPage/delete')}"
                    data-subcheck="true" data-msg="你确定删除吗？">{:lang('DELETE')}
            </button>
        </div> -->
        <div class="table-actions">
           每页条数： <select style="width: 100px; " name="pagenum" onchange="changePage(this);">
                <option value="10">10</option>
                <option value="20">20</option>
                <option value="50">50</option>
                <option value="100">100</option>
                <option value="200">200</option>
            </select><br>
            <div class="pagination">{$page}</div>
        </div>
        
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script>
    $('select[name=pagenum]').val("{$pagenum|default='10'}");

    function changePage(num){
        $('#pagenum').val(num.value);
        var params=getFormParam();
        window.location.href='?'+params;
    }
    function daochu1() {
            var bookVersionId = '9999';
            $.each($('input[type=checkbox]:checked'), function (i, itesm) {
                var examResultIds = $(itesm).attr('data-id');
                bookVersionId = bookVersionId +  ',' + examResultIds;
            });
            console.log(bookVersionId);
           window.location.href = 'daochu.html?dcid=' + bookVersionId;
        }
    function getFormParam(){
        var params = $('#search').serialize(); 
        return params;
    }
</script>
</body>
</html>